package com.crrc.yzt.demo.vm

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.crrc.yzt.demo.model.ItemMain
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch

class MainVM : ViewModel() {


    private val _itemMainStateFlow:MutableStateFlow<List<ItemMain>?> = MutableStateFlow(null)
    val itemMainStateFlow = _itemMainStateFlow.asStateFlow()


    fun loadList(){
        viewModelScope.launch {

            val list = mutableListOf<ItemMain>()

            list.add(ItemMain("湘A5X1T8D","TEG6158BEV02","在线","LSFGA2301MD404030","2023/12/25 9:48:52"))

            _itemMainStateFlow.emit(list)
        }
    }

}